home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Tools & Apps / Misc. Utilities / Installer / Installer 3.2 / Samples - Installer 3.2 / InstallINIT.r < prev    next >
Encoding:
Text File  |  1992-01-22  |  5.7 KB  |  159 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.2 sample: demonstrates installing an INIT into the appropriate folder
  6.  *
  7.  *    File:        InstallINIT.r -    Rez Source
  8.  *
  9.  *    by:            Jon Zap
  10.  *
  11.  *    Copyright © 1991 Apple Computer, Inc.
  12.  *    All rights reserved.
  13.  *
  14.  *------------------------------------------------------------------------------
  15.  * This sample installs "TheINIT" into the appropriate system
  16.  * folder.  It allows for custom installation/removal.  With Installer 3.1 we had
  17.  * to distinguish between 7.0 and pre 7.0 systems because the installer would
  18.  * create the extensions folder if it did not exist.  The Installer now handles this
  19.  * so if we specify the extensions folder but it does not exist, the Installer will
  20.  * use the system folder instead. This greatly simplifies the script.
  21.  *----------------------------------------------------------------------------*/
  22.  
  23. #include "Types.r"                    /* for the ICON resource */
  24. #include "InstallerTypes.r"
  25.  
  26. /* You can build and complete the script with the following lines:
  27. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  28. # or set up folders with the same names and contents as the floppies
  29. # put these folders in the same folder as the script or at the root directory of same disk
  30.  
  31.     rez -o "InstallINIT" -t 'bjbc' -c 'bjbc' "InstallINIT.r"
  32.     setfile -a i "InstallINIT"        #mark Inited
  33.     scriptcheck -p "InstallINIT"
  34. */
  35.  
  36. /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
  37. #define kScriptCheckSetsDate    0x01
  38.  
  39. /* Definitions for the rules */
  40. #define rlAddInit                1000
  41.  
  42. /* Defines for the file spec atoms.  These are specifications for source and destination files */
  43. #define fsSourceINIT            2000
  44. #define fsTargetINIT            2001
  45.  
  46. /* This is the name of the source disk */
  47. #define INITDisk "INIT Disk:"
  48.  
  49. /* where we want to install our file. */
  50. #define TargetPath    "special-extns:"
  51.  
  52. /* Definition for the package. */
  53. #define pkTheINIT            3000
  54.  
  55. /* Definition for the file atom */
  56. #define faINIT                4000
  57.  
  58. /* Definition for the package comment resource */
  59. #define cmtTheINIT            5000
  60. #define iconTheINIT            6000
  61.  
  62. /* October 10, 1990 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  63. /* this value to a LongInt seconds value needed by the Installer. */
  64. #define currentReleaseDate        10101990        
  65. #define currentVersion            100     /* Version 1.0 goes in the 'icmt' rsrc */
  66.  
  67.  
  68. /************************** Easy Install Rule resources **********************************/
  69. resource 'infr' (1) {
  70.     format0  {{
  71.         pickAll,    {rlAddInit},     /* Select the rule */
  72.     }};
  73. };
  74.  
  75. /* note the '.' in the first rule is missing in the 2nd rule so we can differentiate*/
  76. resource 'inrl' (rlAddInit) {
  77.     format0 {{
  78.         addUserDescription {"The INIT.\n"},    /* message to appear in Easy Install screen */
  79.         addPackages {{pkTheINIT}}            /* we're installing the INIT */
  80.     }};
  81. };
  82.  
  83. /***************************** Package Resources ************************************************/
  84. resource 'inpk' (pkTheINIT) {
  85.     format0 {
  86.         ShowsOnCustom,                     /* Package appears in the Custom Install display */
  87.         Removable,                        /* Package can be removed */
  88.         forceRestart,                    /* so we actually activate the init */
  89.         cmtTheINIT,                     /* package's 'icmt' resource id */
  90.         0,                                /* Package size (filled in by ScriptCheck) */
  91.         "Install TheINIT", { /* package name for package that shows on custom */
  92.             'infa', faINIT;
  93.         }
  94.     }
  95. };
  96.  
  97. /***************************** Comments ************************************************/
  98. resource 'icmt' (cmtTheINIT) {
  99.     currentReleaseDate,
  100.     currentVersion,
  101.     iconTheINIT,
  102.     "This package contains TheINIT. "
  103. };
  104.  
  105. resource 'ICON' (iconTheINIT) {
  106.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  107.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  108.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  109.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  110.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  111.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  112.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  113.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  114. };
  115.  
  116.  
  117.  
  118. /********************************************* File Specs *******************************************/
  119. /* Source File Specs */
  120. resource 'infs' (fsSourceINIT) {
  121.     'INIT',                                /* File Type */
  122.     '????',                                /* Creator */
  123.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  124.     noSearchForFile,                    /* Do not search the source disk for the file */
  125.     TypeCrMustMatch,                    /* file type and creator on source disk must match */
  126.     INITDisk"TheINIT"                    /* Path to the file */
  127. };
  128.  
  129. /* Target File Specs */
  130. resource 'infs' (fsTargetINIT) {
  131.     'INIT',                                /* File Type */
  132.     '????',                                /* Creator */
  133.     0,                                    /* creation date not needed for target file specs */
  134.     noSearchForFile,                    /* Do not search the target disk for the file */
  135.     TypeCrMustMatch,                    /* not needed for target file specs */
  136.     TargetPath"TheINIT"                    /* destination Path */
  137. };
  138.  
  139.  
  140. /******************************************** File Atoms ************************************************/
  141. resource 'infa' (faINIT) {
  142.     format0 {
  143.         delRemove,                        /* Delete the file if remove (option-custom) is clicked    */
  144.         delInstall,                     /* Delete the target before copying new one */
  145.         copy,                             /* Copy the file to the destination */
  146.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  147.         noKeepExisting,                 /* Always replace an existing copy */
  148.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  149.         rsrcFork, dataFork,                /* Copy both forks of the file */
  150.         fsTargetINIT,                    /* TARGET file spec for this file */
  151.         fsSourceINIT,                     /* SOURCE file spec for this file */
  152.         0,                                /* atom size (filled in by ScriptCheck) */
  153.         ""                                /* Atom Description (Installer will use file name) */
  154.     };
  155. };
  156.  
  157.  
  158.  
  159.